<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="format-detection" content="telephone=no" />
  <meta name="keywords" content="">
  <meta name="description" content="">
  <style>
    .notice_list {
      padding: 0 0.2rem
    }

    .notice_list .item {
      border-bottom: 1px solid #eee;
      padding: 0.2rem 0;
    }

    .notice_list .item p:nth-child(2) {
      text-align: right;
      color: #f85256;
      padding-right: 0.2rem;
    }

    .notice_detail {
      padding: 0 0.2rem
    }

    .notice_detail .item {
      border-bottom: 1px solid #eee;
      padding: 0.2rem 0;
    }

    .notice_detail .item p:nth-child(1) {
      padding-bottom: 0.15rem;
      font-weight: 600;
      letter-spacing: 1px;
    }

    .notice_detail .item p:nth-child(2) {
      color: #bbb;
    }

    .notice_detail .content {
      padding: 0.2rem 0.2rem;
    }

    .trix-content {
      line-height: 1.5;
    }

    .trix-content h1 {
      font-size: 1.2em;
      line-height: 1.2;
      margin: 0;
    }

    .trix-content blockquote {
      margin: 0 0 0 0.3em;
      padding: 0 0 0 0.6em;
      border-left: 0.3em solid #ccc;
    }

    .trix-content pre {
      font-family: monospace;
      font-size: 0.9em;
      margin: 0;
      padding: 0.5em;
      white-space: pre;
      background-color: #eee;
      overflow-x: auto;
    }

    .trix-content ul,
    .trix-content ol,
    .trix-content li {
      margin: 0;
      padding: 0;
    }

    .trix-content ul li,
    .trix-content ol li,
    .trix-content li li {
      margin-left: 1em;
    }

    .trix-content img {
      max-width: 100%;
      height: auto;
    }

    .trix-content a[data-trix-attachment] {
      color: inherit;
      text-decoration: none;
    }

    .trix-content a[data-trix-attachment]:hover,
    .trix-content a[data-trix-attachment]:visited:hover {
      color: inherit;
    }

    .trix-content .attachment {
      display: inline-block;
      position: relative;
      max-width: 100%;
      margin: 0;
      padding: 0;
    }

    .trix-content .attachment .caption {
      padding: 0;
      text-align: center;
    }

    .trix-content .attachment .caption .size:before {
      content: ' · ';
    }

    .trix-content .attachment.attachment-preview {
      width: 100%;
      text-align: center;
    }

    .trix-content .attachment.attachment-preview .caption {
      color: #666;
      font-size: 0.9em;
      line-height: 1.2;
    }

    .trix-content .attachment.attachment-file {
      color: #333;
      line-height: 1;
      margin: 0 2px 2px 0;
      padding: 0.4em 1em;
      border: 1px solid #bbb;
      border-radius: 5px;
    }
  </style>
  <title></title>
</head>

<body class="notice_list">
  <div class="item">
    <p id="title"></p>
    <p id="date"></p>
  </div>
  <div class="content trix-content">
  </div>
</body>

<script>
  (function() {
    function get_content(id, callback) {
      var xmlHttp = new XMLHttpRequest();
      xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
          callback(xmlHttp.responseText);
      }
      xmlHttp.open("GET", '/static/notice/' + id, true);
      xmlHttp.send(null);
    }

    function get_desc(id, callback) {
      var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance
      xmlhttp.open("POST", "../api/000003");
      xmlhttp.setRequestHeader("Content-Type", "application/json");
      xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
          callback(xmlhttp.responseText);
      }
      xmlhttp.send(JSON.stringify({
        notice_id: id
      }));
    }

    var search = window.location.search.substr(1);
    var params = {};
    search.split('&').map(function(keypair) {
      var pair = keypair.split('=');
      params[pair[0]] = decodeURIComponent(pair[1]);
    });
    get_desc(params.notice_id, function(data) {
      var desc = JSON.parse(data).result[0];
      document.getElementById('title').textContent = desc.notice_title;
      document.getElementById('date').textContent = desc.publish_date;
    });
    get_content(params.notice_id, function(content) {
      document.getElementsByClassName('trix-content')[0].innerHTML = content;
    });
  })();
</script>

</html>